Skip to content

ASIO can call associated_allocator<CT, Alloc>::get with only one parameter#1943

Merged
ericniebler merged 2 commits intoNVIDIA:mainfrom
ericniebler:optional-allocator-parameter-in-asio-associated-allocator
Mar 20, 2026
Merged

ASIO can call associated_allocator<CT, Alloc>::get with only one parameter#1943
ericniebler merged 2 commits intoNVIDIA:mainfrom
ericniebler:optional-allocator-parameter-in-asio-associated-allocator

Conversation

@ericniebler
Copy link
Copy Markdown
Collaborator

  STDEXEC::task<void> test(asio::steady_timer& timer)
  {
    co_await timer.async_wait(asio::as_tuple(exec::asio::use_sender));
  }

fails to compile with:

[build] /usr/include/boost/asio/impl/as_tuple.hpp:301:65: fatal error: too few arguments to function call, expected 2, have 1
[build]   301 |     return Associator<Handler, DefaultCandidate>::get(h.handler_);
[build]       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           ^

here, Associator is asio::associated_allocator specialized for ::exec::asio::detail::completion_token::completion_handler. ASIO clearly expects the get static member function to be callable with one argument. get doesn't use its second argument, so making it optional fixes the issue.

attn @RobertLeahy

@RobertLeahy
Copy link
Copy Markdown
Contributor

LGTM.

@ericniebler ericniebler marked this pull request as ready for review March 20, 2026 19:41
@ericniebler ericniebler force-pushed the optional-allocator-parameter-in-asio-associated-allocator branch from d01c355 to e3807bf Compare March 20, 2026 19:44
@ericniebler ericniebler merged commit dfd29d1 into NVIDIA:main Mar 20, 2026
30 checks passed
@ericniebler ericniebler deleted the optional-allocator-parameter-in-asio-associated-allocator branch March 20, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants